package com.daocheng.weblog.common.domain.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.daocheng.weblog.common.domain.dos.CategoryDO;

/**
 * @ClassName CategroyMapper
 * @author: 稻城
 * @date: 2025/3/9
 * @Version 1.0
 * @description: TODO
 */
public interface CategoryMapper extends BaseMapper<CategoryDO> {
    /**
      * @author 稻城
      * @Date 2025/3/9 23:50
      * @param name
      * @return CategoryDO
      * @description 根据分类名称查询
      */
    default CategoryDO selectByName(String name) {
        LambdaQueryWrapper<CategoryDO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(CategoryDO::getName, name);
        queryWrapper.eq(CategoryDO::getIsDeleted, false);
        return selectOne(queryWrapper);
    }
}
